//
//  BookingOrderDetailView.m
//  TryShopping
//
//  Created by panquanReabam.com on 16/8/25.
//  Copyright © 2016年 RuiBen. All rights reserved.
//

#import "BookingOrderDetailView.h"
#import "UIButton+WebCache.h"
#import "GoodsView.h"
@interface BookingOrderDetailView()
@property(nonatomic,strong)UIView*amountView;
@property(nonatomic,strong)UILabel*noLabel;
@property(nonatomic,strong)UILabel*createNameLabel;
@property(nonatomic,strong)UILabel*createName;
@property(nonatomic,strong)UILabel*orderDate;
@property(nonatomic,strong)UILabel*orderDateLabel;
@property(nonatomic,strong)UILabel*totalQuantity;

@property(nonatomic,strong)UILabel*statusName;
@property(nonatomic,strong)UIButton*whsOutTypeName;
@property(nonatomic,strong)UIButton*whsName;
@property(nonatomic,strong)UILabel*memberName;
@property(nonatomic,strong)UILabel*memberNameLabel;
@property(nonatomic,strong)UIImageView*sexImage;
@property(nonatomic,strong)UILabel*levelLabel;
@property(nonatomic,strong)UILabel*level;


@property(nonatomic,strong)UILabel*city;
@property(nonatomic,strong)UILabel*cityName;
@property(nonatomic,strong)UILabel*hospital;
@property(nonatomic,strong)UILabel*hospitalName;

@property(nonatomic,strong)UILabel*bookingTime;
@property(nonatomic,strong)UILabel*bookingTimeName;
@property(nonatomic,strong)UILabel*bookingItem;
@property(nonatomic,strong)UILabel*bookingItemName;
@property(nonatomic,strong)UILabel*couponNo;
@property(nonatomic,strong)UILabel*couponNoName;
@property(nonatomic,strong)UILabel*remark;

@property(nonatomic,strong)UILabel*createName1;
@property(nonatomic,strong)UILabel*createNameLabel1;
@property(nonatomic,strong)UILabel*remarklabel;
@property(nonatomic,strong)UIButton*jiantouBtn;

@end
@implementation BookingOrderDetailView
{
    NSMutableArray*whsOutItem;
    GoodsView*GoodView;
    NSString*payType;
    UIView*remarkVC;
    UIView*remarkView;
    CGFloat height;
    UIImage *image;
    UIView*confirmRemarkView;
    UIView*ComeConfirmRemarkView;
    UIView*couponsView;
}
@synthesize mDelegate;
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
    }
    return self;
}
#pragma mark InitUI
- (void)initUI
{
    self .backgroundColor = zuiqianhuiColor;
    
    UIView*view1=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 70)];
    view1.backgroundColor=[UIColor whiteColor];
    [self addSubview:view1];
    _noLabel=[[UILabel alloc]init];
    _noLabel.textColor=[UIColor blackColor];
    _noLabel.font=[UIFont systemFontOfSize:17];
    [view1 addSubview:_noLabel];
   _statusName=[[UILabel alloc]init];
    _statusName.textColor=luseColor;
    _statusName.font=[UIFont systemFontOfSize:Statusfot];
    [self addSubview:_statusName];

    UILabel *line1=[[UILabel alloc] initWithFrame:CGRectMake(0, 70, ScreenWidth, 0.40)];
    line1.backgroundColor=qianhuiColor;
    [view1 addSubview:line1];
    _createName=[[UILabel alloc]init];
    _createName.text=[NSString stringWithFormat:@"来源"];
    _createName.textColor=zhonghuiColor;
    _createName.font=[UIFont systemFontOfSize:contenfot];
    [view1 addSubview:_createName];
    _createNameLabel=[[UILabel alloc]init];
    _createNameLabel.textColor=shenhuiColor;
    _createNameLabel.font=[UIFont systemFontOfSize:contenfot];
    [view1 addSubview:_createNameLabel];
    
    _orderDate=[[UILabel alloc]init];
    _orderDate.text=@"时间";
    _orderDate.textColor=zhonghuiColor;
    _orderDate.font=[UIFont systemFontOfSize:contenfot];
    [view1 addSubview:_orderDate];
    
    _orderDateLabel=[[UILabel alloc]init];
    _orderDateLabel.textColor=shenhuiColor;
    _orderDateLabel.font=[UIFont systemFontOfSize:contenfot];
    [view1 addSubview:_orderDateLabel];
    
    UIView*view2=[[UIView alloc]initWithFrame:CGRectMake(0, view1.bottom+10, ScreenWidth, 45)];
    view2.backgroundColor=[UIColor whiteColor];
    view2.layer.borderWidth = 0.40;
    view2.layer.borderColor = qianhuiColor.CGColor;
    [self addSubview:view2];
    

    _memberName=[[UILabel alloc]init];
    _memberName.textColor=qianheiColor;
    _memberName.font=[UIFont systemFontOfSize:16];
    [self addSubview:_memberName];
    
    _sexImage=[[UIImageView alloc]init];
    [self addSubview:_sexImage];
    
    _level=[[UILabel alloc]init];
    _level.textColor=zhonghuiColor;
    _level.text=@"等级";
    _level.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_level];
    
    _levelLabel=[[UILabel alloc]init];
    [_levelLabel.layer setCornerRadius:1.5];
    [_levelLabel.layer setBorderWidth:0];
    [_levelLabel.layer setMasksToBounds:YES];
    _levelLabel.textColor=[UIColor whiteColor];
    _levelLabel.font=[UIFont systemFontOfSize:13];
    [self addSubview:_levelLabel];
    remarkVC=[[UIView alloc]initWithFrame:CGRectMake(0, view2.bottom+10, ScreenWidth, 475/2)];
    remarkVC.backgroundColor=[UIColor whiteColor];
    remarkVC.layer.borderColor = qianhuiColor.CGColor;
    [remarkVC.layer setBorderWidth:0.30];   //边
    [self addSubview:remarkVC];
    UILabel*shangpingxinxi=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 80, 45)];
    shangpingxinxi.text=@"预约信息";
    shangpingxinxi.textColor=[UIColor blackColor];
    shangpingxinxi.font=[UIFont systemFontOfSize:15];
    [remarkVC addSubview:shangpingxinxi];
    
    _createName1=[[UILabel alloc]init];
    _createName1.textColor=shenhuiColor;
    _createName1.text=@"姓名";
    _createName1.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_createName1];
    _createNameLabel1=[[UILabel alloc]init];
    _createNameLabel1.textColor=qianheiColor;
    _createNameLabel1.textAlignment=NSTextAlignmentRight;
    _createNameLabel1.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_createNameLabel1];

    
    _city=[[UILabel alloc]init];
    _city.textColor=shenhuiColor;
    _city.text=@"手机号";
    _city.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_city];
    _cityName=[[UILabel alloc]init];
    _cityName.textColor=qianheiColor;
     _cityName.textAlignment=NSTextAlignmentRight;
    _cityName.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_cityName];
    _hospital=[[UILabel alloc]init];
    _hospital.textColor=shenhuiColor;
    _hospital.text=@"预约门诊所";
    _hospital.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_hospital];
    _hospitalName=[[UILabel alloc]init];
    _hospitalName.textColor=qianheiColor;
   _hospitalName.textAlignment=NSTextAlignmentRight;
    _hospitalName.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_hospitalName];
    _bookingTime=[[UILabel alloc]init];
    _bookingTime.textColor=shenhuiColor;
    _bookingTime.text=@"预约时间";
    _bookingTime.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_bookingTime];
    _bookingTimeName=[[UILabel alloc]init];
    _bookingTimeName.textColor=qianheiColor;
    _bookingTimeName.textAlignment=NSTextAlignmentRight;
    _bookingTimeName.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_bookingTimeName];
    
    _bookingItem=[[UILabel alloc]init];
    _bookingItem.textColor=shenhuiColor;
    _bookingItem.text=@"预约项目";
    _bookingItem.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_bookingItem];
    _bookingItemName=[[UILabel alloc]init];
    _bookingItemName.textColor=qianheiColor;
     _bookingItemName.textAlignment=NSTextAlignmentRight;
    _bookingItemName.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_bookingItemName];
    
    
    _couponNo=[[UILabel alloc]init];
    _couponNo.textColor=shenhuiColor;
    _couponNo.text=@"优惠券";
    _couponNo.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_couponNo];
    _couponNoName=[[UILabel alloc]init];
    _couponNoName.textColor=qianheiColor;
    _couponNoName.textAlignment=NSTextAlignmentRight;
    _couponNoName.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_couponNoName];
 
 
    _heightView=[[UIView alloc]init];
    _heightView.backgroundColor=qianhuiColor;
    [self addSubview:_heightView];
   
}



-(void)jiantouBtn:(UIButton*)sender{
    
    [mDelegate memberBtn:@""];
    
    
}
-(void)setBookingOrderDetailModel:(BookingOrderDetailModel *)BookingOrderDetailModel{

    [self initUI];
    [self setViewAutoLayout];
    
    _noLabel.text=[NSString stringWithFormat:@"%@",  [[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"orderNo"]];
    _createNameLabel.text=[NSString stringWithFormat:@"%@",[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"source"]];
    _orderDateLabel.text=[NSString stringWithFormat:@"%@",[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"createDate"]];
    
    
    if ([[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"status"] isEqualToString:@"NA"]) {
        _statusName.textColor=hongseColor;
    }else
        if ([[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"status"] isEqualToString:@"YR"]) {
            _statusName.textColor=hongseColor;
        }else{
            
            _statusName.textColor=luseColor;
        }
    
    _statusName.text=[NSString stringWithFormat:@"%@",[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"statusName"]];
    
   NSDictionary *value = [BookingOrderDetailModel.dict objectForKey:@"member"];
    NSLog(@"---%ld",value.count);
    if (value.count==0)
    {
        self.memberName.text=@"零售会员";
        self.sexImage.image=[UIImage imageNamed:@""];
        _level.text=@"";
        _levelLabel.backgroundColor=[UIColor clearColor];
        _levelLabel.text=@"";

        
    }
    else
    {
        self.memberName.text=[NSString stringWithFormat:@"%@ (%@)",[[BookingOrderDetailModel.dict objectForKey:@"member"] objectForKey:@"memberName"], [[BookingOrderDetailModel.dict objectForKey:@"member"] objectForKey:@"phone"]];
        if (![[[BookingOrderDetailModel.dict objectForKey:@"member"] objectForKey:@"sex"] isEqual:[NSNull null]]) {
            
            if ([[[BookingOrderDetailModel.dict objectForKey:@"member"] objectForKey:@"sex"]isEqualToString:@"男"]) {
                self.sexImage.image=[UIImage imageNamed:@"nan"];
                
                
            }else{
                self.sexImage.image=[UIImage imageNamed:@"nv"];
            }
        }else{
            self.sexImage.image=[UIImage imageNamed:@"nv"];
            
            
        }
        _levelLabel.text=[Global getJudgeTheErrorStr: [NSString stringWithFormat:@"%@",  [[BookingOrderDetailModel.dict objectForKey:@"member"] objectForKey:@"gradeName"]]];
        _levelLabel.backgroundColor=[UIColor colorWithRed:209/255.0 green:170/255.0 blue:56/255.0 alpha:1.0];
    }
   
    

    _bookingItemName.text=[NSString stringWithFormat:@"%@",[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"bookingItemName"]];
    _bookingTimeName.text=[NSString stringWithFormat:@"%@ %@",[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"bookingDate"],[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"bookingTime"]];
    _createNameLabel1.text=[NSString stringWithFormat:@"%@",[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"userName"]];
    _cityName.text=[NSString stringWithFormat:@"%@",[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"phone"]];
    _hospitalName.text=[NSString stringWithFormat:@"%@",[[BookingOrderDetailModel.dict objectForKey:@"companyBaseInfo"]objectForKey:@"companyName"]];
   
    NSMutableArray *coupons = [[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"coupons"];
    NSLog(@"---%@",coupons);
    
    couponsView=[[UIView alloc]initWithFrame:CGRectMake(60, 165, ScreenWidth-60, 32.5)];
    [remarkVC addSubview:couponsView];
    if (coupons.count>0){
        couponsView.frame=CGRectMake(60, 165, ScreenWidth-60, 18*coupons.count+12.5);
        for (int i = 0; i<coupons.count; i++) {
        UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(0, 3+18*i, ScreenWidth-75, 18)];
        label.textColor=qianheiColor;
        label.text=[NSString stringWithFormat:@"%@",[coupons[i]objectForKey:@"couponName"]];
        label.textAlignment=NSTextAlignmentRight;
        label.font=[UIFont systemFontOfSize:contenfot];
        [couponsView addSubview:label];
       
        }
       }else{

        UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth-75, 30)];
        label.textColor=qianheiColor;
        label.text=@"无";
        label.textAlignment=NSTextAlignmentRight;
        label.font=[UIFont systemFontOfSize:contenfot];
        [couponsView addSubview:label];

   
    }

    UIImageView*line = [[UIImageView alloc]initWithFrame:CGRectMake(10,couponsView.bottom, ScreenWidth-20, 0.5)];
    line.image=[UIImage imageNamed:@"hengxian"];
    [remarkVC addSubview:line];
    
    _remark=[[UILabel alloc]initWithFrame:CGRectMake(15, couponsView.bottom+5, 60, 30)];
    _remark.textColor=shenhuiColor;
    _remark.text=@"备注";
    _remark.font=[UIFont systemFontOfSize:contenfot];
    [remarkVC addSubview:_remark];
    
    _remarklabel=[[UILabel alloc]initWithFrame:CGRectMake(15, _remark.bottom-5, 60, 30)];
    _remarklabel.textColor=qianheiColor;
    _remarklabel.numberOfLines=0;
    _remarklabel.font=[UIFont systemFontOfSize:contenfot];
    [remarkVC addSubview:_remarklabel];

    NSString *s1 =[NSString stringWithFormat:@"%@", [[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"remark"]];
    if (s1.length>1) {
        UIFont *font1 = [UIFont systemFontOfSize:contenfot];
        CGSize size1 = CGSizeMake(ScreenWidth-60, 2000);
        CGSize labelsize1 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
        _remarklabel.text=s1;
        _remarklabel.frame=CGRectMake(10, _remark.bottom-5, ScreenWidth-20, labelsize1.height+10);
        remarkVC.frame=CGRectMake(0, 80+55, ScreenWidth, _remarklabel.bottom+5);
    }else{
        _remarklabel.text=@"无";
        remarkVC.frame=CGRectMake(0, 80+55, ScreenWidth, _remarklabel.bottom+5);

    }
    

    NSString *acceptRemark =[NSString stringWithFormat:@"%@", [[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"acceptRemark"]];
      NSString *refuseRemark =[NSString stringWithFormat:@"%@", [[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"refuseRemark"]];
      NSString *comeConfirmRemark =[NSString stringWithFormat:@"%@", [[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"comeConfirmRemark"]];
      NSString *confirmRemark =[NSString stringWithFormat:@"%@", [[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"confirmRemark"]];
      NSString *status = [NSString stringWithFormat:@"%@",[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"status"]];
      NSMutableArray *images = [[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"images"];

     NSString *acceptConfirmDate =[NSString stringWithFormat:@"%@ %@", [[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"acceptConfirmDate"],[[BookingOrderDetailModel.dict objectForKey:@"order"]objectForKey:@"acceptConfirmTime"]];
    
    if ([status isEqualToString:@"YR"]) {
        [self refuseRemarkStr:refuseRemark];
        _heightView.frame=CGRectMake(0, remarkView.bottom, ScreenWidth, 0.15);
    }
    else if ([status isEqualToString:@"YF"]) {
        [self acceptRemarkStr:acceptRemark acceptConfirmTimeStr:acceptConfirmDate];
        [self comeConfirmRemarkStr:comeConfirmRemark  ];
        [self confirmRemarkStr:confirmRemark imagesArry:images ];
        _heightView.frame=CGRectMake(0, confirmRemarkView.bottom, ScreenWidth, 0.15);
    }else if ([status isEqualToString:@"YD"]){
        [self acceptRemarkStr:acceptRemark acceptConfirmTimeStr:acceptConfirmDate];
        [self comeConfirmRemarkStr:comeConfirmRemark ];
        _heightView.frame=CGRectMake(0, ComeConfirmRemarkView.bottom, ScreenWidth, 0.15);
    }else if ([status isEqualToString:@"YA"]){
        [self acceptRemarkStr:acceptRemark acceptConfirmTimeStr:acceptConfirmDate];
        _heightView.frame=CGRectMake(0, remarkView.bottom, ScreenWidth, 0.15);
   
    }else if ([status isEqualToString:@"NA"]){

        _heightView.frame=CGRectMake(0, remarkView.bottom, ScreenWidth, 0.15);
        
    }
}



//得到root viewControl
- (UIViewController *)appRootViewController
{
    UIViewController *appRootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
    UIViewController *topVC = appRootVC;
    while (topVC.presentedViewController) {
        topVC = topVC.presentedViewController;
    }
    return topVC;
}

- (void)tapAction:(UIButton*)sender{
    
    [[SDWebImageManager sharedManager]downloadWithURL:[NSURL URLWithString:sender.titleLabel.text] options:SDWebImageLowPriority progress:^(NSUInteger receivedSize, long long expectedSize) {
    } completed:^(UIImage *image2, NSError *error, SDImageCacheType cacheType, BOOL finished) {
        
        if (image2) {
            image = image2;
            UIScrollView *scroll = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
            scroll.backgroundColor = [UIColor blackColor];
            [[self appRootViewController].view addSubview:scroll];
            
            UIImageView *imagev = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth,ScreenWidth*image.size.height/image.size.width)];
            imagev.image = image;
            if (imagev.frame.size.height < ScreenHeight) {
                imagev.center = scroll.center;
            }
            
            [scroll addSubview:imagev];
            scroll.contentSize = CGSizeMake(ScreenWidth, imagev.frame.size.height);
            
            UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction2)];
            [scroll addGestureRecognizer:tap];
            scroll.tag = 100;

        }
    }];

    
    
   }

- (void)tapAction2 {
    UIScrollView *scroll = (UIScrollView *)[[self appRootViewController].view viewWithTag:100];
    [scroll removeFromSuperview];
}


//受理信息、、、、、、、、
-(void)acceptRemarkStr:(NSString *)acceptRemark acceptConfirmTimeStr:(NSString *)acceptConfirmTime{

    UIFont *font1 = [UIFont systemFontOfSize:contenfot];
    CGSize size1 = CGSizeMake(ScreenWidth-60, 2000);
    CGSize labelsize1 = [acceptRemark sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
    remarkView=[[UIView alloc]initWithFrame:CGRectMake(0,remarkVC.bottom+10, ScreenWidth, 75)];
    remarkView.backgroundColor=[UIColor whiteColor];
    remarkView.layer.borderWidth = 0.40;
    remarkView.layer.borderColor = qianhuiColor.CGColor;
    [self addSubview:remarkView];
    
    UILabel*remarkLabel=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, ScreenWidth, 35)];
    remarkLabel.text=@"受理信息";
    remarkLabel.font= [UIFont systemFontOfSize:contenfot];
    [remarkLabel setTextColor:qianheiColor];
    [remarkView addSubview:remarkLabel];
    
    
    UILabel*acceptConfirmTimeLabel=[[UILabel alloc]initWithFrame:CGRectMake(15, 30, ScreenWidth, 30)];
    acceptConfirmTimeLabel.text=@"预约时间";
    acceptConfirmTimeLabel.font= [UIFont systemFontOfSize:contenfot];
    [acceptConfirmTimeLabel setTextColor:shenhuiColor];
    [remarkView addSubview:acceptConfirmTimeLabel];
    
    UILabel*acceptConfirmTime1=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-200, 30, 185, 30)];
    acceptConfirmTime1.text=acceptConfirmTime;
    acceptConfirmTime1.font= [UIFont systemFontOfSize:contenfot];
    [acceptConfirmTime1 setTextColor:shenhuiColor];
    acceptConfirmTime1.textAlignment=NSTextAlignmentRight;
    [remarkView addSubview:acceptConfirmTime1];
    
    UILabel*remarkLabel1=[[UILabel alloc]initWithFrame:CGRectMake(10, acceptConfirmTimeLabel.bottom, ScreenWidth-20, labelsize1.height+10)];
    if (acceptRemark.length>0) {
    }else{
        acceptRemark=@"无";
    }
    remarkLabel1.text=acceptRemark;
    remarkLabel1.numberOfLines=0;
    remarkLabel1.font= [UIFont systemFontOfSize:contenfot];
    [remarkLabel1 setTextColor:shenhuiColor];
    [remarkView addSubview:remarkLabel1];
    remarkView.frame=CGRectMake(0, remarkVC.bottom+10, ScreenWidth, remarkLabel1.height+65);

}
//到诊信息、、、、、、、、
-(void)comeConfirmRemarkStr:(NSString *)comeConfirmRemark {
    UIFont *font2 = [UIFont systemFontOfSize:contenfot];
    CGSize size2 = CGSizeMake(ScreenWidth-60, 2000);
    CGSize labelsize2 = [comeConfirmRemark sizeWithFont:font2 constrainedToSize:size2 lineBreakMode:NSLineBreakByCharWrapping];
    
    ComeConfirmRemarkView=[[UIView alloc]initWithFrame:CGRectMake(0,remarkView.bottom+10, ScreenWidth, 75)];
    ComeConfirmRemarkView.backgroundColor=[UIColor whiteColor];
    ComeConfirmRemarkView.layer.borderWidth = 0.50;
    ComeConfirmRemarkView.layer.borderColor = qianhuiColor.CGColor;
    [self addSubview:ComeConfirmRemarkView];
    
    UILabel*ComeConfirmRemark=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, ScreenWidth, 35)];
    ComeConfirmRemark.text=@"到诊信息";
    ComeConfirmRemark.font= [UIFont systemFontOfSize:contenfot];
    [ComeConfirmRemark setTextColor:qianheiColor];
    [ComeConfirmRemarkView addSubview:ComeConfirmRemark];
    
    
    
    UILabel*ComeConfirmRemark1=[[UILabel alloc]initWithFrame:CGRectMake(10, ComeConfirmRemark.bottom, ScreenWidth-20, labelsize2.height+10)];
    if (comeConfirmRemark.length>0) {
    }else{
        comeConfirmRemark=@"无";
    }
    ComeConfirmRemark1.text=comeConfirmRemark;
    ComeConfirmRemark1.numberOfLines=0;
    ComeConfirmRemark1.font= [UIFont systemFontOfSize:contenfot];
    [ComeConfirmRemark1 setTextColor:shenhuiColor];
    [ComeConfirmRemarkView addSubview:ComeConfirmRemark1];
    ComeConfirmRemarkView.frame=CGRectMake(0, remarkView.bottom+10, ScreenWidth, ComeConfirmRemark1.height+45);
    
}

//就诊信息、、、、、、、、
-(void)confirmRemarkStr:(NSString *)confirmRemark  imagesArry:(NSMutableArray *)images{
    
    UIFont *font3 = [UIFont systemFontOfSize:contenfot];
    CGSize size3 = CGSizeMake(ScreenWidth-60, 2000);
    CGSize labelsize3 = [confirmRemark sizeWithFont:font3 constrainedToSize:size3 lineBreakMode:NSLineBreakByCharWrapping];
    confirmRemarkView=[[UIView alloc]initWithFrame:CGRectMake(0,ComeConfirmRemarkView.bottom+10, ScreenWidth, 75)];
    confirmRemarkView.backgroundColor=[UIColor whiteColor];
    confirmRemarkView.layer.borderWidth = 0.40;
    confirmRemarkView.layer.borderColor = qianhuiColor.CGColor;
    [self addSubview:confirmRemarkView];
    
    UILabel*ConfirmRemark=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, ScreenWidth, 35)];
    ConfirmRemark.text=@"就诊信息";
    ConfirmRemark.font= [UIFont systemFontOfSize:contenfot];
    [ConfirmRemark setTextColor:qianheiColor];
    [confirmRemarkView addSubview:ConfirmRemark];
    
    UILabel*ConfirmRemark1=[[UILabel alloc]initWithFrame:CGRectMake(10, ConfirmRemark.bottom, ScreenWidth-20, labelsize3.height+10)];
    if (confirmRemark.length>0) {
    }else{
        confirmRemark=@"无";
    }
    ConfirmRemark1.text=confirmRemark;
    ConfirmRemark1.numberOfLines=0;
    ConfirmRemark1.font= [UIFont systemFontOfSize:contenfot];
    [ConfirmRemark1 setTextColor:shenhuiColor];
    [confirmRemarkView addSubview:ConfirmRemark1];
    NSLog(@"----%@",images);
    
    if (images.count>0) {
        
        for (int i = 0,j = -1; i < images.count; i++) {
            if (i%3 == 0) {
                j++;
            }
            
            UIButton *clothView = [[UIButton alloc]initWithFrame:CGRectMake(15+(ScreenWidth/3-45/3+7.5)*(i%3), ConfirmRemark1.bottom+10+(ScreenWidth/3-45/3+10)*j, ScreenWidth/3-45/3, ScreenWidth/3-45/3)];
            [clothView setImageWithURL:[NSURL URLWithString:[[images objectAtIndex:i] objectForKey:@"imageUrlFull"]]];
            clothView.layer.borderWidth = 0.45;
            clothView.layer.borderColor = qianhuiColor.CGColor;
            
            [clothView setTitle:[[images objectAtIndex:i] objectForKey:@"imageUrlFull"] forState:UIControlStateNormal];
            
            [clothView setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
            [clothView addTarget:self action:@selector(tapAction:) forControlEvents:UIControlEventTouchUpInside];
            
            [confirmRemarkView addSubview:clothView];
            
            height = (ScreenWidth/3-45/3+10)*(j+1);
        }
        
        
        
        height=ConfirmRemark1.bottom+height;
        
    }else{
        height=ConfirmRemark1.bottom;
        
    }
    
    confirmRemarkView.frame=CGRectMake(0, ComeConfirmRemarkView.bottom+10, ScreenWidth, height+10);
    
}


//拒绝信息、、、、、、、、
-(void)refuseRemarkStr:(NSString *)refuseRemark{
    UIFont *font1 = [UIFont systemFontOfSize:contenfot];
    CGSize size1 = CGSizeMake(ScreenWidth-60, 2000);
    CGSize labelsize1 = [refuseRemark sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
    
    remarkView=[[UIView alloc]initWithFrame:CGRectMake(0,remarkVC.bottom+10, ScreenWidth, 75)];
    remarkView.backgroundColor=[UIColor whiteColor];
    remarkView.layer.borderWidth = 0.40;
    remarkView.layer.borderColor = qianhuiColor.CGColor;
    [self addSubview:remarkView];
    
    UILabel*remarkLabel=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, ScreenWidth, 35)];
    remarkLabel.text=@"拒绝信息";
    remarkLabel.font= [UIFont systemFontOfSize:contenfot];
    [remarkLabel setTextColor:qianheiColor];
    [remarkView addSubview:remarkLabel];
    
    UILabel*remarkLabel1=[[UILabel alloc]initWithFrame:CGRectMake(10, remarkLabel.bottom, ScreenWidth-20, labelsize1.height+10)];
    if (refuseRemark.length>0) {
    }else{
        refuseRemark=@"无";
    }
    remarkLabel1.text=refuseRemark;
    remarkLabel1.numberOfLines=0;
    remarkLabel1.font= [UIFont systemFontOfSize:contenfot];
    [remarkLabel1 setTextColor:shenhuiColor];
    [remarkView addSubview:remarkLabel1];
    remarkView.frame=CGRectMake(0, remarkVC.bottom+10, ScreenWidth, remarkLabel1.height+45);
    
    
}

-(void)setViewAutoLayout
{
    
    [self.noLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@17);
        make.top.equalTo(self.mas_top).with.offset(15);
    }];

    
    [self.statusName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.noLabel.mas_right).with.offset(7.5);
        make.height.equalTo(@13);
        
        make.centerY.equalTo(self.noLabel.mas_centerY) ;
    }];

    [self.createName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.mas_top).with.offset(85/2);
    }];
    [self.createNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.createName.mas_right).with.offset(3) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.mas_top).with.offset(85/2);
    }];
    [self.orderDate mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.createNameLabel.mas_right).with.offset(15) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.mas_top).with.offset(85/2);
    }];
    
    [self.orderDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.orderDate.mas_right).with.offset(3) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.mas_top).with.offset(85/2);
    }];
    
    [self.memberName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@45);
       make.top.equalTo(self.mas_top).with.offset(80);
        
    }];
    [self.sexImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.memberName.mas_right).with.offset(3);
        make.height.equalTo(@20);
        make.width.equalTo(@20);
        make.centerY.equalTo(self.memberName.mas_centerY) ;
    }];
    
    [self.level mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.sexImage.mas_right).with.offset(15);
        make.height.equalTo(@14);
        make.centerY.equalTo(self.memberName.mas_centerY) ;
        
    }];
    [self.levelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.level.mas_right).with.offset(3);
        make.height.equalTo(@14);
        make.centerY.equalTo(self.memberName.mas_centerY) ;
        
    }];
   

    
    [self.createName1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@45);
        make.top.equalTo(self.mas_top).with.offset(162.5);
        
    }];
    
    [self.createNameLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).with.offset(-15) ;
        make.height.equalTo(@45);
        make.centerY.equalTo(self.createName1.mas_centerY) ;
        
    }];

    
    
    [self.city mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@45);
        make.top.equalTo(self.mas_top).with.offset(162.5+25);
        
    }];
    
    [self.cityName mas_makeConstraints:^(MASConstraintMaker *make) {
         make.right.equalTo(self.mas_right).with.offset(-15) ;
        make.height.equalTo(@45);
        make.centerY.equalTo(self.city.mas_centerY) ;
        
    }];

    [self.hospital mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@45);
        make.top.equalTo(self.mas_top).with.offset(162.5+50);
        
    }];
    
    [self.hospitalName mas_makeConstraints:^(MASConstraintMaker *make) {
          make.right.equalTo(self.mas_right).with.offset(-15) ;
        make.height.equalTo(@45);
        make.centerY.equalTo(self.hospital.mas_centerY) ;
        
    }];
    [self.bookingTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@45);
        make.top.equalTo(self.mas_top).with.offset(162.5+75);
        
    }];
    
    [self.bookingTimeName mas_makeConstraints:^(MASConstraintMaker *make) {
      make.right.equalTo(self.mas_right).with.offset(-15) ;
        make.height.equalTo(@45);
        make.centerY.equalTo(self.bookingTime.mas_centerY) ;
        
    }];
    [self.bookingItem mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@45);
        make.top.equalTo(self.mas_top).with.offset(162.5+100);
        
    }];
    
    [self.bookingItemName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).with.offset(-15) ;
        make.height.equalTo(@45);
        make.centerY.equalTo(self.bookingItem.mas_centerY) ;
        
    }];
    [self.couponNo mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@45);
        make.top.equalTo(self.mas_top).with.offset(162.5+125);
        
    }];
    
    [self.couponNoName mas_makeConstraints:^(MASConstraintMaker *make) {
          make.right.equalTo(self.mas_right).with.offset(-15) ;
        make.height.equalTo(@45);
        make.centerY.equalTo(self.couponNo.mas_centerY) ;
        
    }];
    
    
    
    
    
    
}


@end
